package point24.view;


import javax.swing.*;
import java.awt.*;

public class GameView extends JFrame {
    protected JTextField jTextFieldA;
    protected JTextField jTextFieldB;
    protected JTextField jTextFieldC;
    protected JTextField jTextFieldD;
    protected JButton jButtonSolve;
    protected JButton jButtonRand;
    protected JButton jButtonAbout;
    protected JButton jButtonInput;

    protected JButton jButtonSave;
    protected JButton jButtonQuery;
    protected JList jListResult;
    protected JLabel jLabelHint;

    public GameView() {
        setTitle("趣味24点小游戏ver1.0，2023安工大《Java编程实训》");
        setLayout(new BorderLayout());

        JPanel numbers = new JPanel();
        numbers.setLayout(new GridLayout(1, 4));
        numbers.add(jTextFieldA = new JTextField(2), 0, 0);
        numbers.add(jTextFieldB = new JTextField(2), 0, 1);
        numbers.add(jTextFieldC = new JTextField(2), 0, 2);
        numbers.add(jTextFieldD = new JTextField(2), 0, 3);
        this.add(numbers, BorderLayout.NORTH);

        JPanel buttons = new JPanel();
        buttons.setLayout(new GridLayout(6, 1));
        buttons.add(jButtonSolve = new JButton("计算答案"), 0, 0);
        buttons.add(jButtonSave = new JButton("存入云库"), 1, 0);
        buttons.add(jButtonQuery = new JButton("查询云库"), 2, 0);
        buttons.add(jButtonRand = new JButton("随机出题"), 3, 0);
        buttons.add(jButtonInput = new JButton("输入题目"), 4, 0);
        buttons.add(jButtonAbout = new JButton("关于程序"), 5, 0);
        this.add(buttons, BorderLayout.EAST);


        JScrollPane scrollPane = new JScrollPane();
        scrollPane.add(jListResult = new JList(new String[]{""}));
        scrollPane.setViewportView(jListResult);
        this.add(scrollPane, BorderLayout.CENTER);


        this.add(jLabelHint = new JLabel("hint"), BorderLayout.SOUTH);

        this.setLocationRelativeTo(null);//居中显示窗体
        this.setResizable(false);// 禁用最大化按钮
        this.setVisible(true);
        this.setSize(480, 600);
        //this.pack();
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }


}
